package cn.bopomo.dealer.base.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import cn.bopomo.dealer.base.common.ServiceConfig;
import cn.bopomo.dealer.base.service.IOperatorService;
import cn.bopomo.dealer.base.vo.OperatorDetail;

public class ShowMyModulesAction extends BaseAction {

	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
				
		String userId = this.getUserId(request);
		
		
		
		IOperatorService os = (IOperatorService)this.findService(ServiceConfig.OPERATOR_SERVICE);
		OperatorDetail op = os.getOperatorDetail(userId);
		//op.getModuleAuthorize = 获取拥有权限组的信息
		Map moduleList = os.getModuleListByTag(op.getModuleAuthorize());
		
		if (moduleList != null && moduleList.size()>0)
			request.setAttribute("moduleList",moduleList);
		
		return this.findSuccess(mapping);
	}
}
